<%@ page import="com.drophair.jspwork.bean.Sqlgoods" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.util.Arrays" %><%--
  Created by IntelliJ IDEA.
  User: drophair
  Team: 深藏blow
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>购物车结算</title>
    <script src="/js/jquery-3.4.1.min.js"></script>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <style>
        #goodimg {
            height: 30%;
        }

        .pay {
            display: inline-block;
        }

        .pay img {
            height: 55%;
        }

    </style>
</head>
<body background="/img/bg2.jpg">
<h1>结算</h1>
<hr>
<%
    String[] goodsid = (String[]) request.getAttribute("goodchecked");
    Sqlgoods sqlgoods = new Sqlgoods();
%>
<div>
    <table border="1" style="display: inline-block">
        <%
            double sum=0;
            for (int i = 0; i < goodsid.length; i++) {
                Vector vector = sqlgoods.getGoodInfo(goodsid[i]);
                String goodid = "", goodname = "", goodprice = "";
                goodname = (String) vector.get(1);
                goodprice = (String) vector.get(2);
                sum+=Double.parseDouble(goodprice);
//                goodprice = (String) vector.get(3);
                System.out.println(goodid + "..." + goodname + "..." + goodprice);
        %>
        <tr>
            <td class="list-group-item"><img src="/img/li.png" id="goodimg" style="height: 30%"></td>
            <td class="list-group-item">商品名称：<%=goodname%><br>商品数量：1件</td>
            <td class="list-group-item"><%=goodprice%>
            </td>
        </tr>
        <%}%>
        <tr><td>共计</td><td><%=goodsid.length%>件商品</td><td><%=sum%>元</td></tr>
    </table>
</div>
<div class="pay">
    <img src="/img/wechat.jpg"><br/>
    <a class="btn btn-success btn-lg" href="/common/activecode.jsp">我已付款</a>
</div>
&nbsp;
<div class="pay">
    <img src="/img/alipay.jpg"><br/>
    <a class="btn btn-success btn-lg" href="/common/activecode.jsp">我已付款</a>
</div>
</body>
</html>
